package com.example.validator.constraints;

import com.example.validator.constraintvalidators.FileCountValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 验证文件数组的长度必须在 min 到 max 之间
 * @author 悠一木碧
 * @date 2021年03月26日 21:50
 */
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = FileCountValidator.class)
public @interface FileCount {

    String message() default "{com.example.validator.constraints.FileCount.message}";

    Class<?>[] groups() default {};

    int min() default 0;

    int max() default 1;

    Class<? extends Payload>[] payload() default {};
}
